/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asfabdesk.dominio;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;

/**
 *
 * @author Marco Aurelio
 */
@Entity
@NamedQueries(value = {
    @NamedQuery(name = "HistoricoPorDeposito", query = "SELECT h FROM HistoricoFinanceiro h WHERE dataRegistro BETWEEN (?) AND (?) AND depositoFinanceiro=?  ")
})
public class HistoricoFinanceiro implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private int tipo; // 1= entrada , 2 =saida, 3 = Entrada transf, 4= Saida transf
    private EntradaFinanceira entrada;
    private SaidaFinanceira saida;
    private SaidaTransferencia saidaTransf;
    private EntradaTransferencia entradaTransf;
    private int motivo; // 1= Entrada Confirmada, 2=E Estornada, 3=E Cancelada, 4=Saida Confirmada, 5= S Estornada, 6=S Cancelada, 7=Entrada Transf , 8= Saida transf
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataRegistro = new Date();
    @JoinColumn(name = "DEPOSITO_FINANCEIRO", referencedColumnName = "id")
    @ManyToOne
    private DepositoFinanceiro depositoFinanceiro;

    public HistoricoFinanceiro() {
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public EntradaFinanceira getEntrada() {
        return entrada;
    }

    public void setEntrada(EntradaFinanceira entrada) {
        this.entrada = entrada;
    }

    public int getMotivo() {
        return motivo;
    }

    public void setMotivo(int motivo) {
        this.motivo = motivo;
    }

    public SaidaFinanceira getSaida() {
        return saida;
    }

    public void setSaida(SaidaFinanceira saida) {
        this.saida = saida;
    }

    public SaidaTransferencia getTransferencia() {
        return saidaTransf;
    }

    public void setTransferencia(SaidaTransferencia transferencia) {
        this.saidaTransf = transferencia;
    }

    public int getTipo() {
        return tipo;
    }

    public void setTipo(int tipo) {
        this.tipo = tipo;
    }

    public Date getDataRegistro() {
        return dataRegistro;
    }

    public void setDataRegistro(Date dataRegistro) {
        this.dataRegistro = dataRegistro;
    }

    public EntradaTransferencia getEntradaTransf() {
        return entradaTransf;
    }

    public void setEntradaTransf(EntradaTransferencia entradaTransf) {
        this.entradaTransf = entradaTransf;
    }

    public SaidaTransferencia getSaidaTransf() {
        return saidaTransf;
    }

    public void setSaidaTransf(SaidaTransferencia saidaTransf) {
        this.saidaTransf = saidaTransf;
    }

    public DepositoFinanceiro getDepositoFinanceiro() {
        return depositoFinanceiro;
    }

    public void setDepositoFinanceiro(DepositoFinanceiro depositoFinanceiro) {
        this.depositoFinanceiro = depositoFinanceiro;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoricoFinanceiro)) {
            return false;
        }
        HistoricoFinanceiro other = (HistoricoFinanceiro) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "asfabdesk.dominio.HistoricoFinanceiro[id=" + id + "]";
    }
}
